package com.cuijq.ms.adapt.v4;

import com.cuijq.ms.adapt.v3.ASensitiveWordsFilter;
import com.cuijq.ms.adapt.v3.BSensitiveWordsFilter;
import com.cuijq.ms.adapt.v3.CSensitiveWordsFilter;
import java.util.ArrayList;
import java.util.List;

/**
 * @author by CuiJQ
 * @Classname RiskManagement
 * @Description RiskManagement Description
 * @Date 2021/5/26 22:37
 */
public class RiskManagement {

  private List<ISensitiveWordsFilter> filters = new ArrayList<>();

  public void addSensitiveWordsFilter(ISensitiveWordsFilter filter) {
    filters.add(filter);
  }

  public String filterSensitiveWords(String text) {
    String maskedText = text;
    for (ISensitiveWordsFilter filter : filters) {
      maskedText = filter.filter(maskedText);
    }
    return maskedText;
  }
}
